package com.mt.demo.controller;


import com.mt.demo.domain.AjaxResult;
import com.mt.demo.domain.MtMember;
import com.mt.demo.domain.TableDataInfo;
import com.mt.demo.service.IMtMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 参会成员Controller
 * 
 * @author gary
 * @date 2025-08-11
 */
@RestController
@RequestMapping("/mt/mtMember")
public class MtMemberController extends BaseController
{
    @Autowired
    private IMtMemberService mtMemberService;

    /**
     * 查询参会成员列表
     */
    @GetMapping("/list")
    public TableDataInfo list(MtMember mtMember)
    {
        startPage();
        List<MtMember> list = mtMemberService.selectMtMemberList(mtMember);
        return getDataTable(list);
    }

    /**
     * 导出参会成员列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, MtMember mtMember)
    {
        List<MtMember> list = mtMemberService.selectMtMemberList(mtMember);
//        ExcelUtil<MtMember> util = new ExcelUtil<MtMember>(MtMember.class);
//        util.exportExcel(response, list, "参会成员数据");
    }

    /**
     * 获取参会成员详细信息
     */
    @GetMapping(value = "/{memberId}")
    public AjaxResult getInfo(@PathVariable("memberId") Long memberId)
    {
        return success(mtMemberService.selectMtMemberByMemberId(memberId));
    }

    /**
     * 新增参会成员
     */
    @PostMapping
    public AjaxResult add(@RequestBody MtMember mtMember)
    {
        return toAjax(mtMemberService.insertMtMember(mtMember));
    }

    /**
     * 修改参会成员
     */
    @PutMapping
    public AjaxResult edit(@RequestBody MtMember mtMember)
    {
        return toAjax(mtMemberService.updateMtMember(mtMember));
    }

    /**
     * 删除参会成员
     */
	@DeleteMapping("/{memberIds}")
    public AjaxResult remove(@PathVariable Long[] memberIds)
    {
        return toAjax(mtMemberService.deleteMtMemberByMemberIds(memberIds));
    }
}
